#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QStandardItemModel>
#include <QtCharts>


#define COL_NAME    0
#define COL_MATH    1
#define COL_CHINESE 2
#define COL_ENGLISH 3
#define COL_AVERAGE 4

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT
private:
    QStandardItemModel *dataModel;
    void readExcelUsedRange(QString fileName);
    void removeAllxis(QChart *chart);

    void iniBarChart();
    void drawBarChart(bool isVertical=true);
    void iniStackedBar();
    void drawStackedBar(bool isVertical=true);
    void iniPercentBar();
    void drawPercentBar(bool isVertical=true);
    void iniPieChart();
    void drawPieChart();
private slots:
    void do_calcuAverage(QStandardItem *item);
    void do_barHovered(bool status,int index,QBarSet *barset);
    void do_barClicked(int index,QBarSet *barset);
    void do_pieHovered(QPieSlice *slice,bool state);
    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_clicked();

    void on_pushButton_8_clicked();

    void on_pushButton_9_clicked();

    void on_pushButton_10_clicked();

    void on_pushButton_11_clicked();

    void on_comboBox_3_currentIndexChanged(int index);

    void on_pushButton_12_clicked();





    void on_doubleSpinBox_valueChanged(double arg1);

    void on_checkBox_clicked(bool checked);

    void on_doubleSpinBox_2_valueChanged(double arg1);

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
};


#endif // MAINWINDOW_H
